package com.ims.core.doc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ims.common.annotation.Log;
import com.ims.common.core.controller.BaseController;
import com.ims.common.core.domain.AjaxResult;
import com.ims.common.enums.BusinessType;
import com.ims.core.doc.domain.TInCollectNonInvoice;
import com.ims.core.doc.service.ITInCollectNonInvoiceService;
import com.ims.common.utils.poi.ExcelUtil;
import com.ims.common.core.page.TableDataInfo;

/**
 * 采集非增值税发票结果Controller
 *
 * @author IMS
 * @date 2024-11-20
 */
@RestController
@RequestMapping("/doc/collectnoninvoice")
public class TInCollectNonInvoiceController extends BaseController
{
    @Autowired
    private ITInCollectNonInvoiceService tInCollectNonInvoiceService;

    /**
     * 查询采集非增值税发票结果列表
     */
    @PreAuthorize("@ss.hasPermi('doc:collectnoninvoice:list')")
    @GetMapping("/list")
    public TableDataInfo list(TInCollectNonInvoice tInCollectNonInvoice)
    {
        startPage();
        List<TInCollectNonInvoice> list = tInCollectNonInvoiceService.selectTInCollectNonInvoiceList(tInCollectNonInvoice);
        return getDataTable(list);
    }

    /**
     * 导出采集非增值税发票结果列表
     */
    @PreAuthorize("@ss.hasPermi('doc:collectnoninvoice:export')")
    @Log(title = "采集非增值税发票结果", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TInCollectNonInvoice tInCollectNonInvoice)
    {
        List<TInCollectNonInvoice> list = tInCollectNonInvoiceService.selectTInCollectNonInvoiceList(tInCollectNonInvoice);
        ExcelUtil<TInCollectNonInvoice> util = new ExcelUtil<TInCollectNonInvoice>(TInCollectNonInvoice.class);
        util.exportExcel(response, list, "采集非增值税发票结果数据");
    }

    /**
     * 获取采集非增值税发票结果详细信息
     */
    @PreAuthorize("@ss.hasPermi('doc:collectnoninvoice:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tInCollectNonInvoiceService.selectTInCollectNonInvoiceById(id));
    }

    /**
     * 新增采集非增值税发票结果
     */
    @PreAuthorize("@ss.hasPermi('doc:collectnoninvoice:add')")
    @Log(title = "采集非增值税发票结果", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TInCollectNonInvoice tInCollectNonInvoice)
    {
        return toAjax(tInCollectNonInvoiceService.insertTInCollectNonInvoice(tInCollectNonInvoice));
    }

    /**
     * 修改采集非增值税发票结果
     */
    @PreAuthorize("@ss.hasPermi('doc:collectnoninvoice:edit')")
    @Log(title = "采集非增值税发票结果", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TInCollectNonInvoice tInCollectNonInvoice)
    {
        return toAjax(tInCollectNonInvoiceService.updateTInCollectNonInvoice(tInCollectNonInvoice));
    }

    /**
     * 删除采集非增值税发票结果
     */
    @PreAuthorize("@ss.hasPermi('doc:collectnoninvoice:remove')")
    @Log(title = "采集非增值税发票结果", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tInCollectNonInvoiceService.deleteTInCollectNonInvoiceByIds(ids));
    }
}
